#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int minimumSize(vector<int>& nums, int maxOperations) {
        int mmax = 0;
        for (auto& e : nums) mmax = max(mmax, e);
        int left = 1, right = mmax;
        while (left <= right)
        {
            int mid = left + (right - left) / 2;
            int k = 0;
            for (auto& e : nums)
            {
                k += e / mid - (e % mid == 0);
            }
            if (k > maxOperations)
                left = mid + 1;
            else
                right = mid - 1;
        }
        return left;
    }
};